﻿using Microsoft.CodeAnalysis;
using System;
using System.Collections.Generic;
using System.Xml.Linq;
using System.Xml.Serialization;

namespace SharpAnalyzer.Entities
{
    [XmlRoot(ElementName = "Member")]
    public class Member
    {
        [XmlAttribute(AttributeName = "Name")]
        public string DisplayName { get; set; }

        [XmlAttribute(AttributeName = "File")]
        public string CodeFile { get; set; }

        [XmlAttribute(AttributeName = "Line")]
        public int LineNumber { get; set; }

        [XmlAttribute(AttributeName = "Kind")]
        public MemberKind Kind { get; set; }

        [XmlIgnore]
        public SyntaxNode SyntaxNode { get; set; }

        public List<Metric> Metrics { get; set; }

        [XmlIgnore]
        public HalsteadMetrics Halstead { get; set; }
    }

    public enum MemberKind
    {
        [XmlEnum(Name = "Method")]
        Method,
        [XmlEnum(Name = "Method")]
        Constructor,
        [XmlEnum(Name = "Method")]
        Destructor,
        [XmlEnum(Name = "Property")]
        GetProperty,
        [XmlEnum(Name = "Property")]
        SetProperty,
        [XmlEnum(Name = "Event")]
        AddEventHandler,
        [XmlEnum(Name = "Event")]
        RemoveEventHandler,
    }
}
